﻿using UnityEngine;
using System.Collections;
using System.Xml.Serialization;


public class PlayerData : DataBase
{

    public Vector3 playerPos;
    public Vector3 playerEul;
    public Vector3 playerSca;
    public float playerSpeed;

}

public class PlayerDataItem : DataItem {

    private PlayerController playerCtrl = null;
    public PlayerDataItem()
    {
        item = new PlayerData();
    }

    public override void Start()
    {
        base.Start();
        playerCtrl = GetComponent<PlayerController>();
    }
    public override void Load(DataBase data)
    {
        transform.localPosition = ((PlayerData)data).playerPos;
        transform.localEulerAngles = ((PlayerData)data).playerEul;
        transform.localScale = ((PlayerData)data).playerSca;
        playerCtrl.walkSpeed = ((PlayerData)data).playerSpeed;
    }

    public override void Save()
    {
        ((PlayerData)item).playerPos = transform.localPosition;
        ((PlayerData)item).playerEul = transform.localEulerAngles;
        ((PlayerData)item).playerSca = transform.localScale;
        ((PlayerData)item).playerSpeed = playerCtrl.walkSpeed;
    }


}
